//
//  ZYCTeaAttendanceStatisticsLeaveCell.m
//  ZDSC
//
//  Created by 张威 on 2021/10/22.
//

#import "ZYCTeaAttendanceStatisticsLeaveCell.h"
#import "ZYCAttendanceStatusGroupBorderView.h"
#import "ZYCTeaLeaveStatisticsModel.h"

@interface ZYCTeaAttendanceStatisticsLeaveCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *line;
@property (nonatomic, strong) ZYCAttendanceStatusGroupBorderView *shijView;
@property (nonatomic, strong) ZYCAttendanceStatusGroupBorderView *bjView;
@property (nonatomic, strong) ZYCAttendanceStatusGroupBorderView *hjView;
@property (nonatomic, strong) ZYCAttendanceStatusGroupBorderView *cjView;
@property (nonatomic, strong) ZYCAttendanceStatusGroupBorderView *sjView;
@property (nonatomic, strong) ZYCAttendanceStatusGroupBorderView *gsjView;
@property (nonatomic, strong) ZYCAttendanceStatusGroupBorderView *ygView;
@property (nonatomic, strong) ZYCAttendanceStatusGroupBorderView *njView;

@end

@implementation ZYCTeaAttendanceStatisticsLeaveCell

- (void)setModel:(ZYCTeaLeaveStatisticsModel *)model{
    _model = model;
    _shijView.count = model.daySHJ;
    _bjView.count = model.dayBJ;
    _hjView.count = model.dayHJ;
    _cjView.count = model.dayCJ;
    
    _sjView.count = model.daySJ;
    _gsjView.count = model.dayGSJ;
    _ygView.count = model.dayYGJ;
    _njView.count = model.dayNJ;

}

- (void)setHeader:(NSString *)header{
    _header = header;
    _titleLabel.text = header;
}



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.line];
        
        [self.contentView addSubview:self.shijView];
        [self.contentView addSubview:self.bjView];
        [self.contentView addSubview:self.hjView];
        [self.contentView addSubview:self.cjView];
        
        [self.contentView addSubview:self.sjView];
        [self.contentView addSubview:self.gsjView];
        [self.contentView addSubview:self.ygView];
        [self.contentView addSubview:self.njView];
 
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(19.0f);
            make.top.equalTo(self.contentView).offset(20.0f);
        }];
        
        [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.contentView);
            make.top.equalTo(self.titleLabel.mas_bottom).offset(17.0f);
            make.height.mas_equalTo(1);
        }];
        
        CGFloat margin  = (kScreenWidth  - 50 * 4) / 5;
        
        [self.shijView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(50, 70));
            make.left.equalTo(self.contentView).offset(margin);
            make.top.equalTo(self.line.mas_bottom).offset(20.0f);
        }];
        
        [self.bjView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(50, 70));
            make.left.equalTo(self.shijView.mas_right).offset(margin);
            make.centerY.equalTo(self.shijView);
        }];
        
        [self.hjView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(50, 70));
            make.left.equalTo(self.bjView.mas_right).offset(margin);
            make.centerY.equalTo(self.shijView);
        }];
        [self.cjView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(50, 70));
            make.left.equalTo(self.hjView.mas_right).offset(margin);
            make.centerY.equalTo(self.shijView);
        }];
        
        [self.sjView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(50, 70));
            make.left.equalTo(self.contentView).offset(margin);
            make.top.equalTo(self.shijView.mas_bottom).offset(20.0f);
        }];
        
        [self.gsjView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(50, 70));
            make.left.equalTo(self.sjView.mas_right).offset(margin);
            make.centerY.equalTo(self.sjView);
        }];
        [self.ygView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(50, 70));
            make.left.equalTo(self.gsjView.mas_right).offset(margin);
            make.centerY.equalTo(self.sjView);
        }];
        
        [self.njView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(50, 70));
            make.left.equalTo(self.ygView.mas_right).offset(margin);
            make.centerY.equalTo(self.sjView);
        }];
    }
    return self;
}
- (ZYCAttendanceStatusGroupBorderView *)shijView {
    if (!_shijView) {
        _shijView = [[ZYCAttendanceStatusGroupBorderView alloc] init];
        _shijView.color = HEX_RGB(@"#00B091");
        _shijView.title = @"事假";
    }
    return _shijView;
}

- (ZYCAttendanceStatusGroupBorderView *)bjView {
    if (!_bjView) {
        _bjView = [[ZYCAttendanceStatusGroupBorderView alloc] init];
        _bjView.color = HEX_RGB(@"#C1C1C1");
        _bjView.title = @"病假";
    }
    return _bjView;
}

- (ZYCAttendanceStatusGroupBorderView *)hjView {
    if (!_hjView) {
        _hjView = [[ZYCAttendanceStatusGroupBorderView alloc] init];
        _hjView.color = HEX_RGB(@"#FD5E54");
        _hjView.title = @"婚假";
    }
    return _hjView;
}


- (ZYCAttendanceStatusGroupBorderView *)cjView {
    if (!_cjView) {
        _cjView = [[ZYCAttendanceStatusGroupBorderView alloc] init];
        _cjView.color = HEX_RGB(@"#97C78C");
        _cjView.title = @"产假";
    }
    return _cjView;
}

- (ZYCAttendanceStatusGroupBorderView *)sjView {
    if (!_sjView) {
        _sjView = [[ZYCAttendanceStatusGroupBorderView alloc] init];
        _sjView.color = HEX_RGB(@"#41B166");
        _sjView.title = @"丧假";
    }
    return _sjView;
}

- (ZYCAttendanceStatusGroupBorderView *)gsjView {
    if (!_gsjView) {
        _gsjView = [[ZYCAttendanceStatusGroupBorderView alloc] init];
        _gsjView.color = HEX_RGB(@"#FFB371");
        _gsjView.title = @"工伤假";
    }
    return _gsjView;
}


- (ZYCAttendanceStatusGroupBorderView *)ygView {
    if (!_ygView) {
        _ygView = [[ZYCAttendanceStatusGroupBorderView alloc] init];
        _ygView.color = HEX_RGB(@"2B7BBF");
        _ygView.title = @"因公";
    }
    return _ygView;
}


- (ZYCAttendanceStatusGroupBorderView *)njView {
    if (!_njView) {
        _njView = [[ZYCAttendanceStatusGroupBorderView alloc] init];
        _njView.color = HEX_RGB(@"#39B5A0");
        _njView.title = @"年假";
    }
    return _njView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kSystemBoldFont(17.0f) titleColor:HEX_RGB(@"#2B302D") textAlignment:ZZTextAlignmentLeft];
    }
    return _titleLabel;
}

- (UILabel *)line {
    if (!_line) {
        _line = [[UILabel alloc] init];
        _line.backgroundColor = HEX_RGB(@"#FAFAFA");
    }
    return _line;
}



@end
